package jastgen.nodes;

import java.util.List;

public class Module {

	private final List<String>       namespace;
	private final List<Import>       imports;
	private final List<InterfaceDef> interfaces;
	private final List<ClassDef>     defines;

	public Module(
			final List<String>       namespace,
			final List<Import>       imports,
			final List<InterfaceDef> interfaces,
			final List<ClassDef>     defines)
	{
		this.namespace  = namespace;
		this.imports    = imports;
		this.interfaces = interfaces;
		this.defines    = defines;
	}

	public String getNamespace() {
		return concat(namespace, ".");
	}

	public List<Import> getImports() {
		return imports;
	}

	public List<InterfaceDef> getInterfaces() {
		return interfaces;
	}

	public List<ClassDef> getClassDefs() {
		return defines;
	}

	private static String concat(
			final List<String> array,
			final String sepalator)
	{
		boolean is1st = true;
		String result = "";
		for(String i : array) {
			if(!is1st)
				result += sepalator;
			result += i;
			is1st = false;
		}
		return result;
	}
}
